/*
 * BBActionSellTower.java
 *
 * Created on March 15, 2008, 7:40 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package hextd.blackBox;

import hextd.util.Context;

/**
 *
 * @author hylke
 */
public class BBActionSellTower implements BBAction {
    
    private static final BlackBox.ActionType type = BlackBox.ActionType.SellTower;
    private int gameTime;
    private int row;
    private int col;
    
    /** Creates a new instance of BBActionSellTower */
    public BBActionSellTower(int gameTime, int row, int col) {
        this.gameTime = gameTime;
        this.row = row;
        this.col = col;
    }
    
    @Override
    public BlackBox.ActionType getType() {
        return BBActionSellTower.type;
    }
    
    @Override
    public int getGameTime() {
        return this.gameTime;
    }
    
    @Override
    public void execute(Context c) {
        //System.out.println("BBActionSellTower::execute: "+c.gameTime+" Selling Tower.");
        if (!c.blackBoxCurrent.sellTower(this.col, this.row)) {
            System.err.println("BBActionSellTower::execute: Sync error: Selling tower failed!");
        }
    }

    @Override
    public String getString() {
        return ""+this.gameTime+" S "+this.row+" "+this.col+"\n";
    }
    
}
